package com.f.controller;

import com.f.bean.Emp;
import com.f.bean.EmpDept;
import com.f.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.client.RestTemplate;

import java.util.List;
@Controller
public class EmpController {

    @Autowired
    private EmpService empService;
    // 走数据库，再走redis
    @RequestMapping("emp/{id}")
    public EmpDept getById(@PathVariable("id") Integer id){
        return empService.getById(id);
    }
    // 直接走，es
    @RequestMapping("emp/by/{empName}")
    public List<Emp> getByName(@PathVariable("empName") String empName){
        return empService.getByName(empName);
    }
}
